#!/usr/bin/env just --justfile

# Using Just: https://github.com/casey/just?tab=readme-ov-file#installation

# List all of the available commands.
default:
  just --list

# Run the web server
dev url='http://localhost:4443/anon':
	bun install
	VITE_RELAY_URL="{{url}}" bun run --filter='*' dev

# Install any dependencies.
install:
	bun install

# Run static checks
check:
	#!/usr/bin/env bash
	set -euo pipefail
	bun install --frozen-lockfile
	if tty -s; then
		bun run --filter='*' --elide-lines=0 check
	else
		bun run --filter='*' check
	fi

# Run the unit tests
test:
	#!/usr/bin/env bash
	set -euo pipefail
	bun install --frozen-lockfile
	if tty -s; then
		bun run --filter='*' --elide-lines=0 test
	else
		bun run --filter='*' test
	fi

# Automatically fix some issues.
fix:
	bun install
	bun run --filter='*' fix

# Upgrade any tooling
upgrade:
	bun update
	bun outdated

# Build the packages
build:
	bun install --frozen-lockfile
	bun run --filter='*' build
